#-*- coding:utf-8 -*-

"""
工具类
"""
import json
import requests



def get_token(appkey,appsecret):
    """
    appkey :    应用 appkey
    appsecret : 应用 appsecret
    """
    url = "https://oapi.dingtalk.com/gettoken"

    header = {
        'Content-Type':'application/json;charset=UTF-8',
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36',
    }

    parms = {'appkey':appkey,'appsecret':appsecret}
    res = requests.get(url,headers=header,params=parms)
    data = res.json()
    access_token = data['access_token']

    return access_token






